<script>
_h=h= Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
var sWidth = parseInt((window.innerWidth > 0) ? window.innerWidth : screen.width);
if(sWidth>750){sWidth=750;}
var _rate=(sWidth/750);
if(h<_rate*1206){h=_rate*1206;}
var _loadW=_rate*490;
var _loadW2=_rate*480;
var _loadBL=_rate*106;
var _loadI=0;
var _jId=4;
var _mbg=document.getElementById("mbg");
var _dm3=document.getElementById("dm3");
var _cm3=document.getElementById("cm3");
$(".p-m").addClass("gorotate");
function _loading(){
	_loadI=_loadI+0.04;
	if(_loadI > 1){
		$(".loading").fadeOut(1400);
		$(".p1").show();
	 _loadI=1;}
	$('.l-bar').css({"left":_loadBL+_loadW2*_loadI});
	$('.l-t1x').width(_loadW*_loadI);
	if(_loadI > .99){return;}
	window.setTimeout(function(){_loading();}, 260);
}
_loading();
var _loadId=1;
function _loadTu(){
	_loadId=_loadId+2;
	if(_loadId >  88){return;}
	$(".l-tu").attr("src","http://lin.mei94.com/dnsj/img/x/"+_loadId+".png");
	window.setTimeout(function(){_loadTu();}, 160);
}
window.setTimeout(function(){
	_loadTu();
}, 300);


var _img=['m.png'];
var loader = new PxLoader();
for(var i=0; i<_img.length; i++){loader.addImage('./img/'+_img[i]);}

for(var j=1; j<89; j=j+2){loader.addImage('http://lin.mei94.com/dnsj/img/x/'+j+".png");}

loader.start();
$(".loading").show();
var _uNext='next';
var _mbgFlag=false;
loader.addCompletionListener(function(e){
	_mbgFlag=true;
    _mbg.play();
    document.addEventListener("WeixinJSBridgeReady", function () {
    	_mbg.play();
    }, false);
});
$(function(){
	  $('.container').width(sWidth).height(h);
	  $('.thebg, .p-b, .upost-d, .upost-save').height(_rate*1206);
	  $('.p1-b1').width(_rate*326).height(_rate*96).css({"top":_rate*1038, "left":_rate*212});
	  $('.rule-close').width(_rate*200).height(_rate*130).css({"top":_rate*800, "left":_rate*284});
	  $('.jpin-close').width(_rate*200).height(_rate*130).css({"top":_rate*880, "left":_rate*284});
	  $('.jpin-jilu').height(_rate*440).css({"top":_rate*436, "left":0});
	  $('.p-m').width(_rate*67).height(_rate*67).css({"top":_rate*10, "left":_rate*10});

	  $('.l-tu').height(_rate*878).css({"top":_rate*128});
	  
	  
	  $('.u2sj-l1, .u2sj-l2, .u2sj-l3, .u2sj-l4').width(_rate*130).height(_rate*99);
	  $('.u2sj-l1').css({"top":_rate*724, "left":_rate*118});
	  $('.u2sj-l2').css({"top":_rate*724, "left":_rate*249});
	  $('.u2sj-l3').css({"top":_rate*724, "left":_rate*380});
	  $('.u2sj-l4').css({"top":_rate*724, "left":_rate*512});

	 
	  
	  $('.l-t1').width(_rate*628).height(_rate*54).css({"top":_rate*984, "left":0});
	  $('.l-t1x').width(0).height(_rate*54).css({"top":_rate*984, "left":_rate*140});
	  $('.l-bar').width(_rate*53).height(_rate*53).css({"top":_rate*984, "left":_rate*126});
	  $('.l-t2').width(_rate*428).height(_rate*47).css({"top":_rate*1072, "left":_rate*182});
	  $('.p1-hdgz').width(_rate*100).height(_rate*155).css({"top":_rate*170, "right":0});
	  $('.p1-jpzc').width(_rate*100).height(_rate*155).css({"top":_rate*344, "right":0});

	  
      var _tmpH=(h - _rate*910)/2;
	  $('.rule-t1').width(sWidth).height(_rate*910).css({"top":_tmpH, "left":0});


	  var _tmpH=(h - _rate*978)/2;
	  $('.jpin-tx1').width(sWidth).height(_rate*978).css({"top":_tmpH, "left":0});
	  
	  var _tmpH=(h - _rate*698)/2;
	  $('.end-t1').width(sWidth).height(_rate*698).css({"top":_tmpH, "left":0});
	  var _tmpH=(h - _rate*970)/2;
	  $('.usj-tu, .usj-t1, .utian-tu, .u2sj-tu, .u2sj-t1').height(_rate*949).css({"top":_tmpH});
	  $('.usj-open').width(_rate*445).height(_rate*185).css({"top":_rate*680, "left":_rate*165});
	  $('.end-cha').width(_rate*350).height(_rate*120).css({"top":_rate*428, "left":_rate*202});
	  $('.end-txt').width(_rate*310).height(_rate*160).css({"top":_rate*188, "left":_rate*152,'line-height':_rate*160+'px'});
	  $('.upost-t1').height(_rate*665);
	  if(h > _rate*1206){
		   var _cha= (h - _rate*1260)/2;
		   if(_cha > 0){
		      $('.thebg').css({"top":_cha});
		   }
	  }
 
	  var _tmpH=(h - _rate*646)/2;
	  $('.g1-t3').width(sWidth).height(_rate*646).css({"top":_tmpH, "left":0});
	  $('.g1-start').width(_rate*350).height(_rate*120).css({"top":_rate*510, "left":_rate*200});
	  $('.time-day').width(_rate*69).height(_rate*65).css({"top":0, "left":_rate*246,'line-height':_rate*65+'px'});
	  $('.time-hour').width(_rate*69).height(_rate*65).css({"top":0, "left":_rate*340,'line-height':_rate*65+'px'});
	  $('.time-sec').width(_rate*69).height(_rate*65).css({"top":0, "left":_rate*438,'line-height':_rate*65+'px'});
	  $('.time-d').width(_rate*33).height(_rate*47);
	  $('.time-d1').css({"top":_rate*20, "left":_rate*312});
	  $('.time-d2').css({"top":_rate*20, "left":_rate*408});
	  $('.tang-h1').width(_rate*208).height(_rate*163).css({"top":0, "left":0});
	  $('.tang-h2').width(_rate*240).height(_rate*278).css({"top":_rate*163, "left":0});
	  $('.tang-h3').width(_rate*265).height(_rate*182).css({"top":0, "left":_rate*250});
	  $('.tang-h4').width(_rate*80).height(_rate*169).css({"top":_rate*290, "left":_rate*670});
	  $('.tang-h5').width(_rate*231).height(_rate*233).css({"top":_rate*576, "left":_rate*310});
	  $('.tang-h6').width(_rate*130).height(_rate*180).css({"bottom":0, "left":0});
	  $('.tang-h7').width(_rate*134).height(_rate*332).css({"bottom":0, "right":0});
	  $('.tang-h8').width(_rate*137).height(_rate*166).css({"bottom":0, "left":_rate*478})
	  
	  
	  $('#u-name').width(_rate*290).height(_rate*52).css({"top":_rate*330, "left":_rate*298});
	  $('#u-lx').width(_rate*290).height(_rate*52).css({"top":_rate*406, "left":_rate*298});
	  $('#u-sf').width(_rate*290).height(_rate*52).css({"top":_rate*476, "left":_rate*298});
	  $('.u-tj').width(_rate*350).height(_rate*170).css({"top":_rate*720, "left":_rate*198});
	  var _tmpH=(h - _rate*542)/2;
	  $('.zhuli-t3').width(_rate*750).height(_rate*542).css({"top":_tmpH, "left":0});
	  $('.zhuli-close').width(_rate*100).height(_rate*120).css({"top":0, "left":_rate*570});
	  $('.zhuli-qing').width(_rate*370).height(_rate*120).css({"top":_rate*260, "left":_rate*190});
	  
	  
	  var ww = $(window).width();
	  var hh = $(window).height();
	  var fishW = 238;
	  var fishH = 386;
	  
	  var pos=[
		  	{startX:ww*.7 , startY:-fishW , endX:-fishW , endY:hh, angle:200 , time:6},
		  	{startX:-fishW , startY:-fishH*.5 , endX:ww*1.1, endY:hh, angle:146, time:6},
		  	{startX:-fishW , startY:fishH*.2 , endX:ww*1.1, endY:hh*.5, angle:120, time:6},
		  	{startX:-126 , startY:hh*0.7 , endX:ww*1.1 , endY:hh*0.2, angle:45, time:8},
		  	{startX:-126 , startY:hh , endX:ww*1.1 , endY:hh*0.2, angle:40, time:8},
		  	{startX:ww , startY:hh*0.1 , endX:-fishW , endY:hh*0.8, angle:-125, time:8},
		  	{startX:ww*1.1 , startY:hh*1.1 , endX:-fishH , endY:-hh, angle:-30, time:8},
		  	{startX:-126 , startY:hh*.7 , endX:ww , endY:hh*0.2, angle:50, time:8},
		  	{startX:ww , startY:hh , endX:-fishW , endY:0, angle:-45, time:8},
		  	{startX:ww, startY: hh*0.6, endX:-ww, endY:hh*0.4, angle:-65, time:9},
		  	{startX:ww*0.6 , startY:-fishH , endX:ww*0.2, endY:hh, angle:210, time:9},
		  	{startX:ww*0.4 , startY:hh , endX:ww*0.7, endY:-fishH, angle:30, time:9},
		  	{startX:ww, startY:hh*0.1, endX:-126, endY:hh*0.5, angle:-125, time:9},
		  	{startX:ww*0.8 , startY:hh , endX:ww*0.1, endY:-fishH, angle:-30, time:9},
		  	{startX:ww*0.1 , startY:-fishH , endX:ww*0.6 , endY:hh, angle:160, time:9},
		  	{startX:-126 , startY:hh*0.6 , endX:ww , endY:hh*0.1, angle:75, time:9},
		  	{startX:ww , startY:hh , endX:ww*0.1, endY:-fishH, angle:-30, time:9},
		  	{startX:ww , startY:-fishH , endX:ww*0.1, endY:hh, angle:-135, time:10},
		  	{startX:-126 , startY:hh*0.7 , endX:ww , endY:hh*0.2, angle:55, time:10},
		  	{startX:ww*0.3 , startY:-fishH , endX:ww*0.4 , endY:hh, angle:160, time:10},
		  	{startX:ww , startY:hh , endX:-fishW , endY:0, angle:-45, time:10}
		  ];
 

	  function setCss3 (obj,attrObj) {
		   for (var i in attrObj) {
		     var newi=i;
			 if(newi.indexOf("-")>0){
			   var num=newi.indexOf("-");
			   newi=newi.replace(newi.substr(num,2),newi.substr(num+1,1).toUpperCase());
			 }
			 obj.style[newi]=attrObj[i];
			 newi=newi.replace(newi.charAt(0),newi.charAt(0).toUpperCase());
			 obj.style["webkit"+newi]=attrObj[i];
			 obj.style["moz"+newi]=attrObj[i];
			 obj.style["o"+newi]=attrObj[i];
			 obj.style["ms"+newi]=attrObj[i];
		   }
	 }	 

	 
	  
	  function resetFish(eqm , eqn , td){
		  $(".fishRun").eq(eqm).css({"top":pos[eqn].startY+"px","left":pos[eqn].startX+"px"})
		  setCss3($(".fishRun").eq(eqm)[0] , {"transform":"scale("+_rate+","+_rate+") rotate("+pos[eqn].angle+"deg)" , "display":"block"})
		  TweenMax.to($(".fishRun").eq(eqm)[0],pos[eqn].time,{left:pos[eqn].endX,top:pos[eqn].endY,repeat:0,delay:td,onComplete:function(){
		  
		  	var o =document.getElementById(this.target.id);
		  	var n2=parseInt(Math.random()*20);
		  	var m2 = o.getAttribute("num");
		  
		  	resetFish(m2 , n2 , 0)
		  }})
	  }
	  function onceFish(eqm , eqn , td){
		  $(".fishRun").eq(eqm).css({"top":pos[eqn].startY+"px","left":pos[eqn].startX+"px"})
		  setCss3($(".fishRun").eq(eqm)[0] , {"transform":"scale("+_rate+","+_rate+") rotate("+pos[eqn].angle+"deg)" , "display":"block"})
		  TweenMax.to($(".fishRun").eq(eqm)[0],pos[eqn].time,{left:pos[eqn].endX,top:pos[eqn].endY,repeat:0,delay:td,onComplete:function(){ }})
	  }
	  var _uRd=0;
	  var timer=null;
	  var _countNum=11;
	  function countDown(){
		     _countNum--;
		    if(_countNum < 0){ 
			    $(".end-txt").html(_uRd);
		    	$(".end, .t-bg").fadeIn();
		    	clearInterval(timer)
		    	TweenMax.killAll();
			    return;} 
		    $(".time-sec").html(_countNum);
	        window.setTimeout(function(){countDown();}, 1000);
	  }
	  
	  function startfn(){
	  	var st = 0;
	  	timer = setInterval(function(){
	  		var m=st;
	  		var n= st;
	  		resetFish(m,n,0);
	  		st++;
	  		if(st>10){
	  			clearInterval(timer)
	  		}
	  	},500);
	  	window.setTimeout(function(){countDown();}, 500);
	  }
 
	 var _newId=11;
	 var resetTimer =setInterval(function(){
		 if(_newId > 15){_newId++;}
	     if(_newId > 16){_newId=11;}
	  },3000);	   
	  
	 <?php
	  if('localhost' == $_SERVER['HTTP_HOST']){
	 ?>
     $(".fishRun").click(function(){
     <?php }else{ ?>
     $(".fishRun").on('touchstart',function(e) {
     <?php } ?>
         var _id=$(this).attr("num");
         $(this).fadeOut();
         _uRd++;
         _cm3.play();
         console.log(_uRd);
         if(_newId > 15){return;}
         onceFish(_newId , _newId , 0);
         _newId++;
     });
    


     $('.p1-b1').click(function(){

    	 $.post("./api/?c=cha", {id:1}, function(data){
        	 if('end' == data.s){
        		 $(".tang, .zhuli, .t-bg").fadeIn();
             }else{
            	 $(".tang, .g1, .t-bg").fadeIn();
             } 
    	 }, "json");
        
     });
     
     $('.p1-hdgz').click(function(){
        $(".t-bg, .rule").fadeIn();
     });

     function _jpzc2(_id){
    	 $.post("./api/?c=shot1234", {id:_id}, function(data){
             if('go' == data.s){
            	 wx.addCard({
              	      cardList: [
              	        {
              	          cardId: data.c.cid,
              	          cardExt: '{"code": "'+data.c.code+'", "openid": "<?php echo $openid; ?>", "timestamp": "'+data.c.timestamp+'", "signature":"'+data.c.sign+'"}'
              	        }
              	      ],
              	      success: function (res) {
              	    	$(".jpin-lig"+_id).attr("src","./img/t/yi2.png");
              	        $.post("./api/?c=code1234", {id:_id,thecode:data.c.code,code:res.cardList[0].code,cid:data.c.cid}, function(data){}, "json");
              	      },
              	      cancel: function (res) {
              	        //alert(JSON.stringify(res))
              	      }
              	    });
              }
          }, "json");

     }

     function _jpzcchakan(){
         var _html='';
    	 $.post("./api/?c=getjpzc", {id:1}, function(data){
        	 console.log(data);
        	 var _has1=_has2=_has3=_has4=false;
             $(data).each(function(key,value){
            	 if(2 == value.j){
            		 _has2=true;
            		 var _btnN1=_btnN2=_btnN3=_btnN4='qu';
                	 if('yes' == value.l1){
                        var _btnN1='yi';
                     }
                	 if('yes' == value.l2){
                         var _btnN2='yi';
                      }
                	 if('yes' == value.l3){
                         var _btnN3='yi';
                      }
                	 if('yes' == value.l4){
                         var _btnN4='yi';
                      }
            		 _html+='<div class="jpin-j2"><img class="jpin-t2" src="<?php echo $cdnUrl; ?>img/t/2.png"><div class="jpin-time">'+value.t+'</div><img class="jpin-lig1" src="<?php echo $cdnUrl; ?>img/t/'+_btnN1+'2.png"><img class="jpin-lig2" src="<?php echo $cdnUrl; ?>img/t/'+_btnN2+'2.png"><img class="jpin-lig3" src="<?php echo $cdnUrl; ?>img/t/'+_btnN3+'2.png"><img class="jpin-lig4" src="<?php echo $cdnUrl; ?>img/t/'+_btnN4+'2.png"></div>';
            		
                 }
            	 if(1 == value.j){
            		 _has1=true;
            		 var _btnName='qu';
                	 if('yes' == value.l1){
                        var _btnName='yi';
                     }
            		 _html+='<div class="jpin-j1"><img class="jpin-t1" src="<?php echo $cdnUrl; ?>img/t/1.png"><div class="jpin-time">'+value.t+'</div><img class="jpin-ling1" data-s="'+value.id+'" src="<?php echo $cdnUrl; ?>img/t/'+_btnName+'.png"></div>';
                 }
            	 if(3 == value.j){
            		 _has3=true;
            		 var _btnName='qu';
                	 if('yes' == value.l1){
                        var _btnName='yi';
                     }
            		 _html+='<div class="jpin-j3"><img class="jpin-t3" src="<?php echo $cdnUrl; ?>img/t/3.png"><div class="jpin-time">'+value.t+'</div><img class="jpin-ling" data-s="'+value.id+'" src="<?php echo $cdnUrl; ?>img/t/'+_btnName+'.png"></div>';
                 }
            	 if(4 == value.j){
            		 _has4=true;
            		 var _btnName='qu';
                	 if('yes' == value.l1){
                        var _btnName='yi';
                     }
            		 _html+='<div class="jpin-j4"><img class="jpin-t4" src="<?php echo $cdnUrl; ?>img/t/4.png"><div class="jpin-time">'+value.t+'</div><img class="jpin-ling" data-s="'+value.id+'" src="<?php echo $cdnUrl; ?>img/t/'+_btnName+'.png"></div>';
                 }
             });
             $(".jpin-jilu").html(_html);
             $('.jpin-ling, .jpin-ling1').width(_rate*150).height(_rate*60);
             if(true == _has2){
                 $('.jpin-j2 .jpin-time').css({"top":_rate*82, "left":_rate*122});
                 $('.jpin-lig1, .jpin-lig2, .jpin-lig3, .jpin-lig4').width(_rate*128).height(_rate*59);
                 $('.jpin-lig1').css({"top":_rate*116, "left":_rate*110});
                 $('.jpin-lig2').css({"top":_rate*116, "left":_rate*242});
                 $('.jpin-lig3').css({"top":_rate*116, "left":_rate*372});
                 $('.jpin-lig4').css({"top":_rate*116, "left":_rate*500});
                 $('.jpin-j2').height(_rate*191);
                 $('.jpin-t2').width(_rate*662).height(_rate*191).css({"top":0, "left":0});
                 $(".jpin-lig1").click(function(){
        			 _jpzc2(1);
        		 });
        		 $(".jpin-lig2").click(function(){
        			 _jpzc2(2);
        		 });
        		 $(".jpin-lig3").click(function(){
        			 _jpzc2(3);
        		 });
        		 $(".jpin-lig4").click(function(){
        			 _jpzc2(4);
        		 });
             }
             if(true == _has1){
                 $('.jpin-j1').height(_rate*86);
                 $('.jpin-t1').width(_rate*658).height(_rate*86).css({"top":0, "left":0});
                 $('.jpin-j1 .jpin-time').css({"top":_rate*54, "left":_rate*122});
                 $('.jpin-j1 .jpin-ling1').css({"top":_rate*14, "left":_rate*480});
                 $(".jpin-ling1").click(function(){
                  var _id=$(this).attr("data-s");
               	  $.post("./api/?c=shota", {id:_id}, function(data){
                   	  if('go' == data.s){
                   		_uNext='jpin'; 
                       	 $(".jpin").fadeOut(); 
                         $(".utian").fadeIn();
                      }
               	  }, "json");  
                });
            }
             if(true == _has3){
                 $('.jpin-j3').height(_rate*86);
                 $('.jpin-t3').width(_rate*658).height(_rate*84).css({"top":0, "left":0});
                 $('.jpin-j3 .jpin-time').css({"top":_rate*50, "left":_rate*122});
                 $('.jpin-j3 .jpin-ling').css({"top":_rate*14, "left":_rate*480});
                 
             }
             if(true == _has4){
            	 $('.jpin-j4').height(_rate*113);
           	     $('.jpin-t4').width(_rate*658).height(_rate*113).css({"top":0, "left":0});
           	     $('.jpin-j4 .jpin-time').css({"top":_rate*78, "left":_rate*122});
           	     $('.jpin-j4 .jpin-ling').css({"top":_rate*24, "left":_rate*480});

             }
             if(true == _has4 || true == _has3){
                 $(".jpin-ling").click(function(){
                       var _id=$(this).attr("data-s");
                       var _this=$(this);
                       console.log(_id);
                       $.post("./api/?c=shotcard", {id:_id}, function(data){
                             if('go' == data.s){
                            	 wx.addCard({
                              	      cardList: [
                              	        {
                              	          cardId: data.c.cid,
                              	          cardExt: '{"code": "'+data.c.code+'", "openid": "<?php echo $openid; ?>", "timestamp": "'+data.c.timestamp+'", "signature":"'+data.c.sign+'"}'
                              	        }
                              	      ],
                              	      success: function (res) {
                              	    	_this.attr("src","./img/t/yi.png");
                              	        $.post("./api/?c=code", {thecode:data.c.code,code:res.cardList[0].code,cid:data.c.cid}, function(data){}, "json");
                              	      },
                              	      cancel: function (res) {
                              	        //alert(JSON.stringify(res))
                              	      }
                              	    });
                              }
                       }, "json");  
                 });
             }
             
    		 $(".t-bg, .jpin").fadeIn();
    	 }, "json");
     }
     
     $('.p1-jpzc').click(function(){
    	 _jpzcchakan();
     });
     $('.rule-close').click(function(){
        $(".t-bg, .rule").fadeOut();
     });
     $('.jpin-close').click(function(){
         $(".t-bg, .jpin").fadeOut();
      });

  
     
     $('.zhuli-close').click(function(){
         $(".zhuli, .t-bg, .tang").fadeOut();
         $(".p1").show();
     });
     var _shareShu=1;
     $('.zhuli-qing').click(function(){
    	 _shareShu=2;
         $(".zhuli").fadeOut();
         $(".share").fadeIn();
     });
     $(".share").click(function(){
         $(".share").fadeOut();
         if(2 == _shareShu){
        	 _shareShu=1;
        	 $(".zhuli").fadeIn();
         }else{
        	 $(".t-bg").fadeOut();
         }
     });

     $('.g1-start').click(function(){
    	 $(".t-bg, .g1").fadeOut();
    	 startfn();
    	 //_mbg.pause();
    	 _dm3.play();
     });

    
     var _thecardId='';
     var _thecode='';
     var _thetimestamp='';
     var _thesignature='';
     $('.usj-open').click(function(){
    	 if(1 == _jId){
    		 $(".usj").fadeOut(); 
    		 $(".utian").fadeIn();
         }else{
        	 $(".usj, .t-bg, .tang").fadeOut(); 
             $(".upost").fadeIn();
        	 wx.addCard({
       	      cardList: [
       	        {
       	          cardId: _thecardId,
       	          cardExt: '{"code": "'+_thecode+'", "openid": "<?php echo $openid; ?>", "timestamp": "'+_thetimestamp+'", "signature":"'+_thesignature+'"}'
       	        }
       	      ],
       	      success: function (res) {
       	        //alert('success：' + JSON.stringify(res.cardList));
       	        $.post("./api/?c=code", {thecode:_thecode,code:res.cardList[0].code,cid:_thecardId}, function(data){}, "json");
           	     
       	      },
       	      cancel: function (res) {
       	        //alert(JSON.stringify(res))
       	      }
       	    });
             
        	 
         }
     });
     var _chaLock=false;
     $('.end-cha').click(function(){
         if(true == _chaLock){return;}
         _chaLock=true;
    	 $.post("./api/?c=open", {urd:_uRd}, function(data){
    		 _jId=data.j;
             if(2 == _jId){
            	 $(".upost-d").attr("src", "./img/j/"+data.n+'-post-bg.jpg');
            	 $(".upost-t2").attr("src", "./img/j/"+data.n+'-t2.png');
            	 $(".upost-save").attr("src", "./img/j/"+data.n+'-post.jpg');
            	 $(".u2sj-tu").attr("src", "./img/j/"+data.n+'.png');
            	 $(".end").fadeOut(); 
            	 $(".u2sj").fadeIn();
             }else{
        		 _thecardId=data.c.cid;;
        	     _thecode=data.c.code;
        	     _thetimestamp=data.c.timestamp;
        	     _thesignature=data.c.signature;
        		 $(".usj-tu").attr("src", "./img/j/"+data.n+'.png');
        		 $(".upost-d").attr("src", "./img/j/"+data.n+'-post-bg.jpg');
        		 $(".upost-t2").attr("src", "./img/j/"+data.n+'-t2.png');
        		 $(".upost-save").attr("src", "./img/j/"+data.n+'-post.jpg');
            	 $(".end").fadeOut(); 
            	 $(".usj").fadeIn();
             }
             _chaLock=false;
    	 }, "json");
     });

     var _gka1=_gka2=_gka3=_gka4='';
     function _getKa(_id){
         if('yes' == _gka1 && 'yes' == _gka2 && 'yes' == _gka3  &&'yes' == _gka4){ 
        	 $(".usj, .u2sj, .t-bg, .tang, .utian").fadeOut();
    		 $(".upost").fadeIn();
         }
         if(1 == _id){
   	     _gka1='yes';
        } 
       	if(2 == _id){
       		_gka2='yes';
         } 
       	if(3 == _id){
       		_gka3='yes';
         } 
       	if(4 == _id){
       		_gka4='yes';
         }
    	 $.post("./api/?c=shot1234", {id:_id}, function(data){
             if('go' == data.s){
            	
            	 wx.addCard({
              	      cardList: [
              	        {
              	          cardId: data.c.cid,
              	          cardExt: '{"code": "'+data.c.code+'", "openid": "<?php echo $openid; ?>", "timestamp": "'+data.c.timestamp+'", "signature":"'+data.c.sign+'"}'
              	        }
              	      ],
              	      success: function (res) {
              	    	$(".u2sj-d"+_id).attr("src","./img/j/l-h.png");
                      	if('yes' == _gka1 && 'yes' == _gka2 && 'yes' == _gka3  &&'yes' == _gka4){
                      		$(".usj, .u2sj, .t-bg, .tang, .utian").fadeOut();
                   		    $(".upost").fadeIn();
                        }
              	        $.post("./api/?c=code1234", {id:_id,thecode:data.c.code,code:res.cardList[0].code,cid:data.c.cid}, function(data){}, "json");
              	      },
              	      cancel: function (res) {
              	        //alert(JSON.stringify(res))
              	      }
              	    });
              }
          }, "json");
     }
     
     $(".u2sj-l1").click(function(){
    	 _getKa(1);
     });
     $(".u2sj-l2").click(function(){
    	 _getKa(2);
     });
     $(".u2sj-l3").click(function(){
    	 _getKa(3);
     });
     $(".u2sj-l4").click(function(){
    	 _getKa(4);
     });
     $('.u-tj').click(function(){
         var _name=$("#u-name").val();
         var _lx=$("#u-lx").val();
         var _sf=$("#u-sf").val();
        if('' == _name){$(".weui-msg").html("请输入姓名");$(".js_dialog").show();return;}
 		if('' == _lx){$(".weui-msg").html("请输入联系方式");$(".js_dialog").show();return;}
 		if(_lx.length < 9 || _lx.length > 11){$(".weui-msg").html("请输入正确联系方式");$(".js_dialog").show();return;}
 		if(10 > _sf.length){$(".weui-msg").html("请输入有效身份证");$(".js_dialog").show();return;}
 		if('' == _sf){$(".weui-msg").html("请输入身份证");$(".js_dialog").show();return;}
    	 $.post("./api/?c=uinfo", {name:_name,lx:_lx,sf:_sf}, function(data){
    		 if('jpin' == _uNext){
        		 $(".jpin-ling1").attr("src","./img/t/yi.png");
    			 $(".utian").fadeOut();
        		 $(".jpin").fadeIn();
        		 _uNext='next'; 
             }else{
            	 $(".usj, .t-bg, .tang, .utian").fadeOut();
        		 $(".upost").fadeIn(); 
             }
        	 }, "json");
     });

     $(".js_dialog").click(function(){
         $(".js_dialog").hide();
 	 }); 	


     $.post("./api/?c=geta", {id:1}, function(data){
         if('yes' == data.s){
             window.setTimeout(function(){
            	 _jpzcchakan();
                 }, 5000);
         } 
     }, "json");
     
   
	wx.config({
        appId: '<?php echo $signPackage["appId"];?>',timestamp: <?php echo $signPackage["timestamp"];?>,
        nonceStr: '<?php echo $signPackage["nonceStr"];?>',signature: '<?php echo $signPackage["signature"];?>',
        jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage', 'onMenuShareQQ', 'onMenuShareWeibo', 'showMenuItems', 'hideMenuItems','addCard','chooseCard','openCard']
    });
    wx.ready(function () {
    		var _title='鱼见金喜 红运鼠你';
    		var _desc='新春捉吉鲤  全民赢金鼠';
    		var _link='http://mei94.com/dnsj/';
    		var _imgUrl='http://mei94.com/dnsj/img/64.png';
    			wx.onMenuShareTimeline({title: _desc, link: _link, imgUrl: _imgUrl,success: function () {
    				$.post("api/?c=share", {id:1}, function(data){}, "json");
    			},cancel: function () { 
    			}});
    			wx.onMenuShareAppMessage({ title: _title, desc: _desc,link: _link,imgUrl: _imgUrl, type: '', dataUrl: '', success: function () {
    				$.post("api/?c=share", {id:1}, function(data){}, "json");
    			},cancel: function () { 
    			}});
    });

    

    $(".p-m").click(function(){
		if(true == _mbgFlag){
			_mbgFlag=false;
			_mbg.pause();
			$(".p-m").removeClass("gorotate");
	    }else{
	    	_mbgFlag=true;
	    	_mbg.play();
	    	$(".p-m").addClass("gorotate");
		}
    });
     
});
</script>